package com.jingtai.platform.controller.supply;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.supply.SupplyGoodsDetail;
import com.jingtai.platform.service.supply.SupplyGoodsDetailService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 供应商商品详情表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:33
 */
@Validated
@RestController
@RequestMapping("/platform/supplygoodsdetail")
@Api(tags = "供应商商品详情表")
public class SupplyGoodsDetailController{

    @Autowired
    private SupplyGoodsDetailService supplyGoodsDetailService;


    @ApiOperation("供应商商品详情表列表查询")
    @GetMapping("/list")
    public ResultUtil aopSupplyGoodsDetailList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return supplyGoodsDetailService.SupplyGoodsDetaillist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询supplyGoodsDetail实体")
    @GetMapping("/getSupplyGoodsDetailById")
    public ResultUtil GetSupplyGoodsDetailById(@CApiParam(name = "id",value = "supplyGoodsDetail实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyGoodsDetailService.getSupplyGoodsDetailById(id);
    }

    @ApiOperation("根据商品编码查询supplyGoodsDetail实体")
    @GetMapping("/getSupplyGoodsDetailByGoodsCode")
    public ResultUtil aopGetSupplyGoodsDetailByGoodsCode(@CApiParam(name = "goodsCode",value = "supplyGoodsDetail实体商品编码",required = true,cNotEmpty = true) @RequestParam("goodsCode") String goodsCode){
        return supplyGoodsDetailService.getSupplyGoodsDetailByGoodsCode(goodsCode);
    }


    @ApiOperation("新增supplyGoodsDetail实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"supplyGoodsDetail.id","supplyGoodsDetail.createTime","supplyGoodsDetail.updateTime","supplyGoodsDetail.deleteFlag"})
    public ResultUtil aopAddSupplyGoodsDetail(@RequestBody @Validated({BaseEntity.Create.class}) SupplyGoodsDetail supplyGoodsDetail){
        return supplyGoodsDetailService.addSupplyGoodsDetail(supplyGoodsDetail);
    }

    @ApiOperation("编辑supplyGoodsDetail实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"supplyGoodsDetail.createTime","supplyGoodsDetail.updateTime","supplyGoodsDetail.deleteFlag"})
    public ResultUtil aopEditSupplyGoodsDetail(@RequestBody @Validated({BaseEntity.Update.class}) SupplyGoodsDetail supplyGoodsDetail){
        return supplyGoodsDetailService.editSupplyGoodsDetail(supplyGoodsDetail);
    }

    @ApiOperation("根据ID删除supplyGoodsDetail实体")
    @GetMapping("/delSupplyGoodsDetailById")
    public ResultUtil aopDelSupplyGoodsDetailById(@CApiParam(name = "id",value = "supplyGoodsDetail实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyGoodsDetailService.delSupplyGoodsDetailById(id);
    }

}






